<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   主题：请教各位关于使用Rcpp包及inline时遇到的问题  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({elements: ["bbpress-forums"]});
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/cn/topic/106926/",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466440706: Accept with keywords: (title(0.0):问题,主题,论坛,时, topn(0.2):大家,软件应用,路径,信息,帖子,编译,编译器,会员,长度,目录,用户名,主站,例子,附件,源代码,版本,C++,越界,密码,普通,问题,错误,主题,系统,总计,多谢,命令行,论坛,源码,讨论区).-->
 </head>
 <body class="topic bbpress single single-topic postid-106926 single-author sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    主题：请教各位关于使用Rcpp包及inline时遇到的问题
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/cn">
       <img src="http://cos.name/cn/wp-content/themes/COS-forest/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <div class="menu-%e8%8f%9c%e5%8d%951-container">
        <ul class="nav-menu" id="menu-%e8%8f%9c%e5%8d%951">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-407772" id="menu-item-407772">
          <a href="http://cos.name/cn/">
           论坛首页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407773" id="menu-item-407773">
          <a href="http://cos.name/cn/forums/">
           讨论区
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407774" id="menu-item-407774">
          <a href="http://cos.name/cn/wp-login.php?action=register">
           注册
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407819" id="menu-item-407819">
          <a href="http://cos.name/">
           主站
          </a>
         </li>
        </ul>
       </div>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-106926 topic type-topic status-publish hentry" id="post-106926">
        <header class="entry-header">
         <h1 class="entry-title">
          请教各位关于使用Rcpp包及inline时遇到的问题
         </h1>
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <div id="bbpress-forums">
          <div class="bbp-breadcrumb">
           <p>
            <a class="bbp-breadcrumb-home" href="http://cos.name/cn/">
             COS论坛 | 统计之都
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-root" href="http://cos.name/cn/forums/">
             讨论区
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/">
             软件应用
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/r-language/">
             S-Plus &amp; R语言
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <span class="bbp-breadcrumb-current">
             请教各位关于使用Rcpp包及inline时遇到的问题
            </span>
           </p>
          </div>
          <div class="bbp-template-notice info">
           <p class="bbp-topic-description">
            该主题包含 20 条回复，4个帖子，最后由
            <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
             <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=14&amp;d=monsterid&amp;r=g"/>
            </a>
            <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
             Ihavenothing
            </a>
            在
            <a href="http://cos.name/cn/topic/106926/page/2/#post-333131" title="回复：请教各位关于使用Rcpp包及inline时遇到的问题">
             4 年 之前
            </a>
            更新。
           </p>
          </div>
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 21 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/106926/page/2/">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/106926/page/2/">
             →
            </a>
           </div>
          </div>
          <ul class="forums bbp-replies" id="topic-106926-replies">
           <li class="bbp-header">
            <div class="bbp-reply-author">
             作者
            </div>
            <!-- .bbp-reply-author -->
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-header -->
           <li class="bbp-body">
            <div class="bbp-reply-header" id="post-106926">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月2日 下午2:28
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-106926">
               1 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-106926 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-1 user-id-107547 topic-author post-106926 topic type-topic status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               大家好，现在刚开始用Rcpp，遇到一些问题，想请教下大家。我用的是WinXP系统，R版本是最新版2.15.0，是从CRAN上直接下载exe安装包安装的，没有自己编译，目录是D:\R。Rtools是完全按照R installation and administration上”Appendix D The Windows toolset”上的指导安装的，版本是2.15.0，目录是D:\Rtools，相关的Path也都设置好了，如下：
              </p>
              <pre class="highlight ">D:\Rtools\bin;
D:\Rtools\gcc-4.6.3\bin;
C:\PROGRA~1\CTEX\MiKTeX\miktex\bin\;
D:\R\R-215~1.0\bin\i386;
C:\WINDOWS;
C:\WINDOWS\system32;</pre>
              <p>
               但是在运行Rcpp包上的例子的时候就出错了，在网上查了一下也没找到合适的解决方案，下面列一下运行的例子和错误信息：
              </p>
              <p>
               1.第1个例子：
              </p>
              <pre class="highlight ">&gt; code &lt;- '#include &lt;Rdefines.h&gt;\nSEXP f(){\n return R_NilValue ; }'
&gt; writeLines( code, "test.c" )
&gt; system( "R CMD SHLIB test.c" )
cygwin warning:
  MS-DOS style path detected: D:/R/R-215~1.0/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/d/R/R-215~1.0/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    &lt;a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames" rel="nofollow"&gt;http://cygwin.com/cygwin-ug-net/using.html#using-pathnames&lt;/a&gt;
gcc  -I"D:/R/R-215~1.0/include" -DNDEBUG    -I"D:/R/R-2.15.0/library/Rcpp/include"      -O3 -Wall  -std=gnu99 -mtune=core2 -c test.c -o test.o
gcc -shared -s -static-libgcc -o test.dll tmp.def test.o D:/R/R-2.15.0/library/Rcpp/lib/i386/libRcpp.a -LD:/R/R-215~1.0/bin/i386 -lR
&gt; dyn.load( "test.dll" )
&gt; .Call( "f" )
NULL
</pre>
              <p>
               这个例子是Eddellbuettel在回答和我遇到的同样问题的时候，建议运行的测试例子，可是我的这个运行没有出错。
              </p>
              <p>
               2.第2个例子：
              </p>
              <pre class="highlight ">&gt; library(Rcpp)
&gt; library(inline)
&gt; src &lt;- '
+ Rcpp::NumericVector xa(a);
+ Rcpp::NumericVector xb(b);
+ int n_xa = xa.size(), n_xb = xb.size();
+
+ Rcpp::NumericVector xab(n_xa+n_xb-1);
+ for (int i = 0; i &lt; n_xa; i++)
+   for (int j = 0; j &lt; n_xb; j++)
+     xab[i + j] += xa[i] * xb[j];
+ return xab;
+ '
&gt; fun&lt;- cxxfunction(signature(a = "numeric", b = "numeric"),
+                   src, plugin = "Rcpp")
cygwin warning:
  MS-DOS style path detected: D:/R/R-215~1.0/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/d/R/R-215~1.0/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    &lt;a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames" rel="nofollow"&gt;http://cygwin.com/cygwin-ug-net/using.html#using-pathnames&lt;/a&gt;
make: *** No rule to make target &lt;code&gt;file15106ea09ab.o', needed by&lt;/code&gt;file15106ea09ab.dll'.  Stop.
ERROR(s) during compilation: source code errors or compiler configuration errors!
Program source:
  1:
  2: // includes from the plugin
  3:
  4: #include &lt;Rcpp.h&gt;
  5:
  6:
  7: #ifndef BEGIN_RCPP
  8: #define BEGIN_RCPP
  9: #endif
 10:
 11: #ifndef END_RCPP
 12: #define END_RCPP
 13: #endif
 14:
 15: using namespace Rcpp;
 16:
 17:
 18: // user includes
 19:
 20:
 21: // declarations
 22: extern "C" {
 23: SEXP file15106ea09ab( SEXP a, SEXP b) ;
 24: }
 25:
 26: // definition
 27:
 28: SEXP file15106ea09ab( SEXP a, SEXP b ){
 29: BEGIN_RCPP
 30:
 31: Rcpp::NumericVector xa(a);
 32: Rcpp::NumericVector xb(b);
 33: int n_xa = xa.size(), n_xb = xb.size();
 34:
 35: Rcpp::NumericVector xab(n_xa+n_xb-1);
 36: for (int i = 0; i &lt; n_xa; i++)
 37:   for (int j = 0; j &lt; n_xb; j++)
 38:     xab[i + j] += xa[i] * xb[j];
 39: return xab;
 40:
 41: END_RCPP
 42: }
 43:
 44:
错误于compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! cygwin warning:
  MS-DOS style path detected: D:/R/R-215~1.0/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/d/R/R-215~1.0/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    &lt;a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames" rel="nofollow"&gt;http://cygwin.com/cygwin-ug-net/using.html#using-pathnames&lt;/a&gt;
make: *** No rule to make target &lt;code&gt;file15106ea09ab.o', needed by&lt;/code&gt;file15106ea09ab.dll'.  Stop.
此外: 警告信息：
运行命令'D:/R/R-215~1.0/bin/i386/R CMD SHLIB file15106ea09ab.cpp 2&gt; file15106ea09ab.cpp.err.txt'的状态是1
</pre>
              <p>
               这个是Rcpp-introduction里面的一个例子，在我这一运行就出错了，查了好久也没找出是什么原因。
              </p>
              <p>
               还请高手多多指点，多谢！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332136">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月2日 下午3:55
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332136">
               2 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332136 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-2 user-id-81532 post-332136 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第1楼 的 lifeconquer：
               <br/>
               初步猜测是make的问题。你试试在命令行中手动编译一下附件中的文件（写在一行中）：
              </p>
              <pre class="highlight ">g++ -shared test.cpp -o test.dll
-ID:/R/R-2.15.0/include
-ID:/R/R-2.15.0/library/Rcpp/include
-LD:/R/R-2.15.0/bin/i386
-LD:/R/R-2.15.0/library/Rcpp/lib/i386
-lRcpp -lR</pre>
              <p>
               看是否会报错？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332138">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月2日 下午4:00
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332138">
               3 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332138 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-3 user-id-81532 post-332138 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第1楼 的 lifeconquer：
               <br/>
               忘传附件了。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332143">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月3日 上午1:40
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332143">
               4 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332143 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-4 user-id-107547 topic-author post-332143 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第2楼 的 Ihavenothing：多谢站长，我刚刚运行了一下，test.dll生成了，没有报错，也没有任何过程信息…我之前在网上查了一下，好多人说是makeconf的问题，但是我读不懂里面的内容…还是说需要用Rtools直接从源码编译R才可以？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332154">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月3日 上午6:50
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332154">
               5 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332154 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-5 user-id-81532 post-332154 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 lifeconquer：
               <br/>
               莫非2.15.0之后就出问题了？你先试下我的Makeconf，R是2.14.2版本的。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332168">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月3日 上午10:55
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332168">
               6 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332168 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-6 user-id-107547 topic-author post-332168 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第5楼 的 Ihavenothing：刚刚试了一下，还是不行，错误信息和以前一样…我对比了一下两个makeconf，只有一小段代码不一样，但是估计不会影响这个：
              </p>
              <p>
               R2.14.2版本的makeconf：
              </p>
              <pre class="highlight ">SHLIB_OPENMP_CFLAGS =
SHLIB_OPENMP_CXXFLAGS =
SHLIB_OPENMP_FCFLAGS =
SHLIB_OPENMP_FFLAGS =
SHLIB_PTHREAD_FLAGS = 
R_XTRA_CPPFLAGS = -I"$(R_HOME)/include"
</pre>
              <p>
              </p>
              <p>
               R2.15.0版本的makeconf：
              </p>
              <pre class="highlight ">SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS = -fopenmp
SHLIB_OPENMP_FCFLAGS = -fopenmp
SHLIB_OPENMP_FFLAGS = -fopenmp
SHLIB_PTHREAD_FLAGS = -pthread
R_XTRA_CPPFLAGS = -I"$(R_HOME)/include" -DNDEBUG
</pre>
              <p>
              </p>
              <p>
               快郁闷死了…几乎能查的都查了，还是不知道怎么回事…站长还有啥建议不？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332173">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月3日 下午1:03
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332173">
               7 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332173 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-7 user-id-81532 post-332173 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第6楼 的 lifeconquer：
               <br/>
               权宜之计是按之前写的用命令行的方式编译，因为inline包实际上也就是生成C++的源代码，然后用自动化的过程编译成dll，你用命令行编译做的是同一件事。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332181">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月3日 下午3:44
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332181">
               8 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332181 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-8 user-id-81532 post-332181 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第6楼 的 lifeconquer：
               <br/>
               我看过了，应该是Rtools的问题。一个可行的解决办法是把Rtools卸载掉（包括相应的系统路径），然后装上另外的编译环境。
               <br/>
               先从这里下载编译器：
               <a class="d4pbbc-url" href="http://mingw-builds.googlecode.com/files/i686-mingw32-gcc-4.7.0-release-c%2Cc%2B%2B%2Cfortran-sjlj.7z" rel="nofollow" target="_blank">
                http://mingw-builds.googlecode.com/files/i686-mingw32-gcc-4.7.0-release-c%2Cc%2B%2B%2Cfortran-sjlj.7z
               </a>
               ，解压后把其中第一级的bin目录加到系统路径中。然后从这里下载make相关的工具：
               <a class="d4pbbc-url" href="http://115.com/file/e7859xdk#msys.7z" rel="nofollow" target="_blank">
                http://115.com/file/e7859xdk#msys.7z
               </a>
               ，也是把bin目录加到Path中。再试试应该就行了。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332202">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午6:58
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332202">
               9 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332202 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-9 user-id-107547 topic-author post-332202 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第7楼 的 Ihavenothing：按照命令行方式编译？是直接写成cpp文件，然后用R CMD SHLIB进行编译吗？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332203">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午7:01
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332203">
               10 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332203 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-10 user-id-107547 topic-author post-332203 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第8楼 的 Ihavenothing：多谢站长，帮我搞了这么久[s:13]…刚刚按照你说的试了一下，代码运行成功了，没有出错信息，也没输出inline后的C++源码，如下：
              </p>
              <pre class="highlight ">&gt; library(Rcpp)
&gt; library(inline)
&gt; src &lt;- '
+ Rcpp::NumericVector xa(a);
+ Rcpp::NumericVector xb(b);
+ int n_xa = xa.size(), n_xb = xb.size();
+
+ Rcpp::NumericVector xab(n_xa+n_xb-1);
+ for (int i = 0; i &lt; n_xa; i++)
+   for (int j = 0; j &lt; n_xb; j++)
+     xab[i + j] += xa[i] * xb[j];
+ return xab;
+ '
&gt; fun&lt;- cxxfunction(signature(a = "numeric", b = "numeric"),
+                   src, plugin = "Rcpp")
</pre>
              <p>
               于是很兴奋的运行了一下，结果运行fun了好多次都出现了一样的错误：内存不能读，冲突的内存地址也不变[s:12]…真无奈了…难道是最近在攒人品…什么样的错误都会遇到…
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332204">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午7:15
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332204">
               11 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332204 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-11 user-id-107547 topic-author post-332204 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               传一下出错的截图，刚刚截图尺寸太大，没能成功上传…
              </p>
              <p>
               [attachment=232204,1831]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332206">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午7:17
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332206">
               12 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332206 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-12 user-id-107547 topic-author post-332206 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               各位牛人们，有懂Rcpp的也出来冒个泡吧，总让站长一个人弄，有点太过意不去了…谢谢大家了！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332212">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午8:49
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332212">
               13 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332212 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-13 user-id-107675 post-332212 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107675/" rel="nofollow" title="查看肖楠的档案">
               <img src="http://sdn.geekzu.org/avatar/66aa115466aeedf71937ff80c00b7982?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107675/" rel="nofollow" title="查看肖楠的档案">
               肖楠
              </a>
              <br/>
              <div class="bbp-author-role">
               版主
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               珍爱生命，做开发请选用 Linux 。。。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332215">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月4日 上午9:13
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332215">
               14 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332215 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-14 user-id-81532 post-332215 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               <img src="http://sdn.geekzu.org/avatar/f09663fd5fc04bad5e5b09daddb86fe6?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/81532/" rel="nofollow" title="查看Ihavenothing的档案">
               Ihavenothing
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第10楼 的 lifeconquer：
               <br/>
               数组越界了吧？
               <code>
                xab
               </code>
               的长度应该是
               <code>
                n_xa + n_xb
               </code>
               。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-332250">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年5月5日 上午8:09
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/106926/#post-332250">
               15 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-332250 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-106926 bbp-reply-position-15 user-id-107547 topic-author post-332250 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               <img src="http://sdn.geekzu.org/avatar/b9910f4f4b33fe714c80f4a42eb58f6a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/107547/" rel="nofollow" title="查看lifeconquer的档案">
               lifeconquer
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第14楼 的 Ihavenothing：貌似没有越界，xab的长度就是n_xa+n_xb-1，这就是做了一个卷积运算…难道windows就这么不给力…非要我转投linux…
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
           </li>
           <!-- .bbp-body -->
           <li class="bbp-footer">
            <div class="bbp-reply-author">
             作者
            </div>
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-footer -->
          </ul>
          <!-- #topic-106926-replies -->
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 21 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/106926/page/2/">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/106926/page/2/">
             →
            </a>
           </div>
          </div>
          <div class="bbp-no-reply" id="no-reply-106926">
           <div class="bbp-template-notice">
            <p>
             您必须先登录才能回复该主题。
            </p>
           </div>
          </div>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <div class="comments-area" id="comments">
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget bbp_widget_login" id="bbp_login_widget-2">
         <h3 class="widget-title">
          登录
         </h3>
         <form action="http://cos.name/cn/wp-login.php" class="bbp-login-form" method="post">
          <fieldset>
           <legend>
            登录
           </legend>
           <div class="bbp-username">
            <label for="user_login">
             用户名:
            </label>
           </div>
           <div class="bbp-password">
            <label for="user_pass">
             密码:
            </label>
           </div>
           <div class="bbp-remember-me">
            <label for="rememberme">
             记住用户名
            </label>
           </div>
           <div class="bbp-submit-wrapper">
            <button class="button submit user-submit" id="user-submit" name="user-submit" tabindex="104" type="submit">
             登录
            </button>
           </div>
           <div class="bbp-login-links">
            <a class="bbp-register-link" href="http://cos.name/cn/wp-login.php?action=register" title="注册">
             注册
            </a>
            <a class="bbp-lostpass-link" href="http://cos.name/cn/wp-login.php?action=lostpassword" title="忘记密码">
             忘记密码
            </a>
           </div>
          </fieldset>
         </form>
        </aside>
        <aside class="widget widget_text" id="text-7">
         <h3 class="widget-title">
          搜索
         </h3>
         <div class="textwidget">
          <form action="http://www.google.com/search" id="bbp-search-form" method="get" onsubmit="Gsitesearch(this)" role="search">
           <div>
           </div>
          </form>
          <form id="bbp-search-form-baidu" onsubmit="g(this)" role="search">
           <div>
           </div>
          </form>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          新鲜事
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/cn/topics/">
             最新帖子
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/popular/">
             最热门主题
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/no-replies/">
             消灭零回复
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          RSS订阅
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/topics/feed/">
             所有主题
            </a>
           </li>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/forums/feed/">
             所有帖子
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
  </div>
 </body>
</html>